package com.iflytek.uoamp.agent.monitor.lib.statics;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

public class StaticsSenderExector {
	private final ScheduledExecutorService scheduExec = Executors.newScheduledThreadPool(1);

	private SataicsSender sender;

	public StaticsSenderExector(SataicsSender sender) {
		this.sender = sender;
	}

	// 定时执行任务
	public void addOneTask() {
		scheduExec.scheduleWithFixedDelay(sender, 1, 1, TimeUnit.SECONDS);
	}

	public void shutDown() {
		scheduExec.shutdown();
	}
}
